import ColorUI from '../colorui/mp-cu/main';
import { Utils } from '../utils/util';

export const colorUI = new ColorUI({
    config: {
        theme: 'auto',
        main: 'blue',
        text: 1,
        footer: false,
        share: false,
        shareTitle: '',
        homePath: '/pages/index/index',
        tabBar: [{
                title: '首页',
                icon: '_icon-home-o',
                curIcon: '_icon-home',
                url: '/pages/index/index',
                type: 'tab'
            },
            {
                title: '',
                icon: 'cicon-camera-o icon-xl ui-BG-Main-4 round borders p-2',
                curIcon: 'cicon-camera  icon-xl ui-BG-Main-4 round borders p-2',
                url: '/pages/photo/camera/camera',
                type: 'nav'
            },
            {
                title: '我的',
                icon: 'cicon-my-o',
                curIcon: 'cicon-my',
                url: '/pages/my/my',
                type: 'tab'
            }
        ]
    },
    data: {
        //服务端所有配置数据,启动时从服务器获取
        serverData:'ServerData',
    },
    methods: {
        getServerData(key){
            const data = wx.getStorageSync(this.data.$cuData.serverData);
            if(key){
                return data[key];
            }else{
                return data;
            }
        },
        showError(params){
            let errmsg = params.title.detail;
            if (typeof(errmsg) == "undefined")
            {
                errmsg =  params.title;
            }
            Utils.showErrorBox(JSON.stringify(errmsg),"错误")
        },
    }
})